const Cloud = require('../sdk/av-core-min')
const handleQuickLogin = async()=>{
    // 3. LeanCloud云服务，实现一键登录（appid、appSecret、code）
    let user = await Cloud.User.loginWithMiniApp()
    console.log('一键登录成功',user);
    let {attributes,id} = user
    attributes.userid = id
    getApp().globalData.userInfo = attributes //全局存放用户信息
    wx.setStorage({ //本地存储
        key:'userInfo',
        data:attributes
    })
    wx.showToast({
        title: '授权登录成功',
        icon:'none'
    })
}

export default {
    handleQuickLogin
}